1 Imports System.Data.OleDb
2 Imports CrystalDecisions.CrystalReports.Engine
3 Imports CrystalDecisions.Shared
4 Imports System.Data
5
6 Public Class frmReportbymarital
7     Public myfilter As String
8     Private mReport As ReportDocument
9
10 #Region
"Report load"
11     Private Sub crvMarital_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles crvMarital.Load
12         mReport = New ReportDocument()
13
14         Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
15         Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
16
17         mReport.Load(Application.StartupPath &
"\crReportbymarital.rpt")
18
19         mReport.RecordSelectionFormula =
"{customers.mstatus} = '" & myfilter & "'"
20
21         For Each tbCurrent In mReport.Database.Tables
22             tliCurrent = tbCurrent.LogOnInfo
23             With tliCurrent.ConnectionInfo
24                 .ServerName = Application.StartupPath &
"\hrs.mdb"
25                 .UserID =
""
26                 .Password =
""
27                 .DatabaseName = Application.StartupPath &
"\hrs.mdb"
28             End With
29             tbCurrent.ApplyLogOnInfo(tliCurrent)
30         Next tbCurrent
31
32         crvMarital.ReportSource = mReport
33     End Sub
34 #End Region
35
36 #Region
"Form is closed"
37     Private Sub frmReportbymarital_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
38         frmMain.Show()
39         Me.Dispose()
40         Me.Close()
41     End Sub
42 #End Region
43
44 End Class


Gõ tìm kiếm nhanh...